<template>
	<view>

	</view>
</template>

<script setup>
	import {
		getQueryString
	} from '@/static/js/common.js'
	import {
		authLogin
	} from '@/network/api.js'
	onLoad(async () => {
		uni.showLoading({
			title: '正在登录'
		})
		const url = window.location.href;
		const urlArr = url.split("?");
		const code = getQueryString("code", urlArr[1]);
		const res = await authLogin({
			code
		})
		if (res.status === 200) {
			uni.setStorageSync('token', res.data.token)
		}
		uni.showToast({
			title: res.msg,
			icon: 'none'
		})
		uni.reLaunch({
			url: '/pages/index/index'
		})
	})
</script>